var entryCardAgreement = function(){
    return{
        agreementEdit: function () {
            $.post('/business/agreementDetail', function (result) {
                console.info(result["rows"][0])
                if (result != null) {
                    //$("#agreementContent").val(result["rows"][0]["content"]);
                    $(document.getElementsByTagName('iframe')[0].contentWindow.document.body).html(result["rows"][0].content);

                }
            }, 'json');
            $('#www').window('open');
        },

        //关闭弹出框
        closePopu: function () {
            $('#www').window('close');
        },
        //保存修改完操作
        save: function () {
            var agreementcontent= $(document.getElementsByTagName('iframe')[0].contentWindow.document.body).html();
            var parmas={agreementcontent:agreementcontent}
            $.ajax({
                type: 'POST',
                url: '/business/agreementEdit',
                dataType: 'json',
                data: parmas,
                success: function (result) {
                    if (result['info'] == 'Success') {
                        alert("协议编辑成功！")
                        entryCardAgreement.closePopu();
                        window.location.reload();
                    } else {
                        alert("协议编辑失败！")
                    }
                }
            })

        },

    }

}
();
